﻿using AutoCADDotNetLibrary;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Customization;
using Autodesk.AutoCAD.Runtime;
using Autodesk.Windows;
using Application = Autodesk.AutoCAD.ApplicationServices.Application;

namespace $rootnamespace$
{
    /// <summary>
    /// $safeitemname$.xaml 的交互逻辑
    /// </summary>
    public partial class $safeitemname$ : RibbonTab
    {
        public $safeitemname$()
        {
            InitializeComponent();
        }

        public static readonly $safeitemname$ Instance = new $safeitemname$();

        [RibbonInitialize()]
        [RibbonButton("添加Ribbon", 0, RibbonButtonStyle = RibbonButtonStyle.LargeWithHorizontalText)]
        [CommandMethod("AddRibbonXAML")]
        public static void AddRibbonXAML()
        {
            if (!ComponentManager.Ribbon.Tabs.Contains(Instance))
            {
                ComponentManager.Ribbon.Tabs.Add(Instance);
            }
        }

        [RibbonButton("直线", 1, RibbonButtonStyle = RibbonButtonStyle.LargeWithHorizontalText)]
        [CommandMethod("lll")]
        public void lll()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            doc.SendStringToExecute("l\n", true, false, false);
        }
    }
}
